Socket
Socket
Sign inDemoInstall

common-tags

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-tags

a few common utility template tags for ES2015


Version published
Weekly downloads
12M
increased by1.09%
Maintainers
2
Weekly downloads
Β 
Created

What is common-tags?

The common-tags npm package provides utility functions for manipulating and using template literals in JavaScript. It offers a variety of tagged template literals for tasks such as stripping indentation, creating multiline strings, and formatting strings with data.

What are common-tags's main functionalities?

Strip Indentation

Strips leading indentation from multiline strings, making it easier to work with template literals without worrying about the formatting in the source code.

`
    This is a string
      that has inconsistent
        indentation.
  `

One Line

Converts a multiline string into a single line, removing all newline characters. Useful for creating single-line strings from template literals that span multiple lines in the source code.

`This is a
multiline string
that will be converted
to a single line.`

Safe HTML

Escapes HTML to prevent XSS attacks when injecting user-generated content into the DOM. This feature ensures that strings are safely encoded.

`<div>${unsafeVariable}</div>`

Other packages similar to common-tags

Keywords

FAQs

Package last updated on 16 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc